package com.itcast.homework.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.itcast.homework.mapper.SkuMapper;
import com.itcast.homework.pojo.Sku;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SkuService {

    @Autowired
    private SkuMapper skuMapper;

    public List<Sku> queryAllSku() {
        QueryWrapper<Sku> queryWrapper = new QueryWrapper<>();
        List<Sku> skuList = skuMapper.selectList(queryWrapper);
        return skuList;
    }

    public Sku querySkuById(String id) {
        QueryWrapper<Sku> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id", id);
        Sku sku = skuMapper.selectOne(queryWrapper);
        return sku;
    }

}
